﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>StringLen</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/commands.css" rel="stylesheet" type="text/css">
<link href="../css/print.css" rel="stylesheet" type="text/css" media="print">
</head>
<body>

<h1>StringLen</h1>

<p>获取字符串长度。</p>

<p class="CommandSyntax">StringLen, OutputVar, InputVar<br>
    Length := <a href="../Functions.htm#StrLen">StrLen</a>(String)</p>
<h3>参数 </h3>
<table border="1" width="100%" cellspacing="0" cellpadding="3" bordercolor="#C0C0C0">
  <tr> 
    <td>OutputVar</td>
    <td>存储字符串长度的变量名。</td>
  </tr>
  <tr> 
    <td width="15%">InputVar</td>
    <td width="85%">需要统计长度的字符串变量名。不要在变量名外加百分号，除非你想使用变量中的 <em>内容</em> 作为变量名。</td>
  </tr>
</table>

<h3>注意</h3>
<p>如果 <em>InputVar</em> 的内容是由 <a href="../misc/Clipboard.htm#ClipboardAll">ClipboardAll</a> 获得的，那么 StringLen 将会返回它的总大小。</p>
<h3>相关命令</h3>
<p><a href="../Functions.htm#StrLen">StrLen()</a>, <a href="IfInString.htm">IfInString</a>, <a href="StringGetPos.htm">StringGetPos</a>, <a href="StringMid.htm">StringMid</a>, <a href="StringTrimLeft.htm">StringTrimLeft</a>, <a href="StringTrimLeft.htm">StringTrimRight</a>, <a href="StringLeft.htm">StringLeft</a>, <a href="StringLeft.htm">StringRight</a>, <a href="StringLower.htm">StringLower</a>, <a href="StringLower.htm">StringUpper</a>, <a href="StringReplace.htm">StringReplace</a></p>
<h3>示例</h3>
<pre class="NoIndent">StringLen, length, InputVar
MsgBox, The length of InputVar is %length%.

MsgBox % &quot;The length of MyVar is &quot; . StrLen(MyVar)</pre>

</body>
</html>
